package com.siashan.toolkit.captcha.core;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 验证码校验结果
 *
 * @author siashan
 * @since v1.0.5
 **/
@Data
@NoArgsConstructor
public class CaptchaCkResult {
    /**
     * 校验结果
     */
    private boolean success;
    /**
     * 结果详情
     */
    private String msg;


    /**
     * 验证码验证通过
     *
     * @return 验证结果
     */
    public static CaptchaCkResult success(){
        return new CaptchaCkResult(true,"图形验证码验证通过");
    }

    /**
     * 验证码验证失败
     *
     * @return 验证结果
     */
    public static CaptchaCkResult fail(){
        return new CaptchaCkResult(false,"图形验证码验证失败");
    }

    /**
     * 验证码验证失败
     *
     * @return 验证结果
     */
    public static CaptchaCkResult empty(){
        return new CaptchaCkResult(false,"图形验证码已过期");
    }

    public CaptchaCkResult(boolean success, String msg) {
        this.success = success;
        this.msg = msg;
    }
}
